<template>
  <div>
    <el-pagination
      v-model:current-page="localTablePage.current"
      v-model:page-size="localTablePage.size"
      v-bind="pageAttribute"
      :total="localTablePage.total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<script setup lang="ts">
//----------------------------------导入区---------------------------------
import { computed } from 'vue'
import type { ResultPageType, SearchPageTypes } from '@/resources/interface/ResultTypes'

//----------------------------------数据区---------------------------------
defineProps<{
  pageAttribute?: any
}>()
const page = defineModel('tablePage')
const localTablePage = computed<ResultPageType>(() => page.value as ResultPageType)
const pageParams = defineModel('pageParams')
const localPageParams = computed<SearchPageTypes>(() => pageParams.value as SearchPageTypes)
let emits = defineEmits(['search'])
// ----------------------------------方法区--------------------------------
const handleSizeChange = (val: number) => {
  localPageParams.value.size = val
  emits('search')
}
const handleCurrentChange = (val: number) => {
  localPageParams.value.current = val
  emits('search')
}
</script>

<style scoped></style>
